package com.zjitc.alipay;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016082600315925";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCeIwyBtaaxZpsF3b8LjOqWgdWinfcllH0cz6IVFvWlzXg8/MunvT4pijvPasPbvCln92lGux96Aqc/bMejdD3CK42/f5EBOSWs0BDlLB+HbJQ70qBPR/yJGWm1CMMmk3JoqwWjHh2f672kwEakCxpXrnOw+sRNTMlOzXcFbqd6XZ+9pBnYFFvtDjoR7DkKtuF+g6BoS2cGmHyFBGg3x9OCM4x6crSuUtYpzfMZ3doRysg6CDZKUomXRl8StL7hJCm4ojVbhH1exofxVJZZkDX8ssEKPB17Rw+wmnZoWOE0HJQm1NR+/zzJ5GJWEu9HwyGBa/B+BevH5YAc4CC4DhPvAgMBAAECggEANerLU9pkmG3cg1aE0eJdBa4E8iob3yNOuSkOIVSvsrVovpqOsYVzkWRBWkoTt3LjR0BzE5uvcsE+1wA23UM/31lMPjO3dAxRDSfv6sNtiJX7wJ3i7MUllHUmtoPjTd7ODmPpSyF0hlcxVN/99eaXN7gSWBBYJ+b7aDPj1eVRkwWXmB4uqholzwDpZLEEpHyV7CvZ3ZaMnYKldmxDeicdKB5/nxQnr/XH3r2rrzVZ/S0pxB3EI2uXzm2zVR3bZLry/Jn4EaIEE6fZUgmWlP/562mDC6XlLHYN6sEhkJl3o5gkznrKif1vmG1t7ih4mw6z0OnZpUn9fP2J7AHzGcN86QKBgQDwQW88q/dEmwSgmQAr/uPvHg7mb3m3kK30hqtANliLoNdjNIM/3/dwdOjNww4E9CCFTyr0PMosed8eM8ikOTMMGQAvFB1XgYJMkA9N3GbVZagMPUCsjybLkYxkgm/gDO6KRgS7/AlOi9gH1FwqBF3LPlWrinV1If2MyU7DmlgfEwKBgQCof/py37Apa5nBL5JReKYLFIj1ZJCKTku93LbrR8K3Za1qRZsOs+AOb1jDE4yUUnqObORKHcIpAnCdw4nhRi2KppOATw4WOszF8EkjEIjESCJzZH9soiugdup1dby7qt2bonhZQYJBzyK5cRARGb9I9Cpkcb27QEMLMilbylVnNQKBgQCl5xlwFPOXbVBBscVbnBQ7f08csqejKYXlz8Sbf6ufJ370I0PqrLaJ8kD8LRAWPZnjVCq+Iugc1D9M9Mc9F753QSBOYh5s2aJnSic3RdXA0AS+BuINBoDsm2IN2cB1P5jM5NLKGJ04nvqbVXobDY7TFQVFgkPfkYwrVqtMCN2G/wKBgEvcoqOJdkSPvz+s7VFk4kzmx+rDhhfevFcUwf4X5uCvFG5ePDtYXK3jD7F0Ybx9jdQFzppX34ybHpzI5pDYCbT83jfMX+k+O+d6EVOKJClK2MffHUeJk97A6zpK8dgES5XAhjKZPc3nNhkLgFJSpz5vP47NbsCZZBXsVZaP9/dpAoGAGaFwmNg3gnUGabCEZ+Hp0TlF8eGzD1glJyd5WWXZlRQtUc6utLDC+4wKQHbZ9jNPbtMif5o8bUMaiwmgoH5vjaG2U6K1l+0AP0h9VflmLecvN+k+40AXw1mUIFVVDHeR5dsXQ1bwxm6oNrFLzQmk/XJqb82sQQ0HXQAmFxD3vq0=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAniMMgbWmsWabBd2/C4zqloHVop33JZR9HM+iFRb1pc14PPzLp70+KYo7z2rD27wpZ/dpRrsfegKnP2zHo3Q9wiuNv3+RATklrNAQ5Swfh2yUO9KgT0f8iRlptQjDJpNyaKsFox4dn+u9pMBGpAsaV65zsPrETUzJTs13BW6nel2fvaQZ2BRb7Q46Eew5CrbhfoOgaEtnBph8hQRoN8fTgjOMenK0rlLWKc3zGd3aEcrIOgg2SlKJl0ZfErS+4SQpuKI1W4R9XsaH8VSWWZA1/LLBCjwde0cPsJp2aFjhNByUJtTUfv88yeRiVhLvR8MhgWvwfgXrx+WAHOAguA4T7wIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/order/paySuccess.do";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

